### Fit the model
nb <- naive_bayes(Species ~ ., iris)
newdata <- iris[1:5,-5] # Let's pretend
### Classification
nb %class% newdata
predict(nb, newdata, type = "class")
### Posterior probabilities
nb %prob% newdata
predict(nb, newdata, type = "prob")
Run the code above in your browser using DataLab